.class Lrexsee/content/RexseeContacts$4;
.super Lrexsee/core/browser/clazz/SyncTask$StringRunnable;
.source "RexseeContacts.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lrexsee/content/RexseeContacts;->getContactNames(Ljava/lang/String;Ljava/lang/String;ZZZZ)Ljava/lang/String;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$0:Lrexsee/content/RexseeContacts;

.field private final synthetic val$account:Ljava/lang/String;

.field private final synthetic val$group:Ljava/lang/String;

.field private final synthetic val$mustHasPhoneNumber:Z

.field private final synthetic val$mustStarred:Z


# direct methods
.method constructor <init>(Lrexsee/content/RexseeContacts;ZZLjava/lang/String;Ljava/lang/String;)V
    .locals 0

    .prologue
    .line 1
    iput-object p1, p0, Lrexsee/content/RexseeContacts$4;->this$0:Lrexsee/content/RexseeContacts;

    iput-boolean p2, p0, Lrexsee/content/RexseeContacts$4;->val$mustHasPhoneNumber:Z

    iput-boolean p3, p0, Lrexsee/content/RexseeContacts$4;->val$mustStarred:Z

    iput-object p4, p0, Lrexsee/content/RexseeContacts$4;->val$account:Ljava/lang/String;

    iput-object p5, p0, Lrexsee/content/RexseeContacts$4;->val$group:Ljava/lang/String;

    .line 618
    invoke-direct {p0}, Lrexsee/core/browser/clazz/SyncTask$StringRunnable;-><init>()V

    return-void
.end method


# virtual methods
.method public run()Ljava/lang/String;
    .locals 14

    .prologue
    const/4 v5, 0x0

    const-string v2, "display_name"

    const-string v2, ""

    .line 622
    :try_start_0
    iget-object v2, p0, Lrexsee/content/RexseeContacts$4;->this$0:Lrexsee/content/RexseeContacts;

    # getter for: Lrexsee/content/RexseeContacts;->mContext:Landroid/content/Context;
    invoke-static {v2}, Lrexsee/content/RexseeContacts;->access$1(Lrexsee/content/RexseeContacts;)Landroid/content/Context;

    move-result-object v2

    invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    .line 625
    .local v0, "contentResolver":Landroid/content/ContentResolver;
    const-string v3, ""

    .line 626
    .local v3, "selection":Ljava/lang/String;
    iget-boolean v2, p0, Lrexsee/content/RexseeContacts$4;->val$mustHasPhoneNumber:Z

    if-eqz v2, :cond_0

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {v3}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v4

    invoke-direct {v2, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v4, "has_phone_number=1"

    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    .line 627
    :cond_0
    iget-boolean v2, p0, Lrexsee/content/RexseeContacts$4;->val$mustStarred:Z

    if-eqz v2, :cond_1

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {v3}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v4

    invoke-direct {v2, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v4, ""

    invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-eqz v4, :cond_4

    const-string v4, "starred=1"

    :goto_0
    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    .line 628
    :cond_1
    iget-object v2, p0, Lrexsee/content/RexseeContacts$4;->val$account:Ljava/lang/String;

    if-eqz v2, :cond_2

    iget-object v2, p0, Lrexsee/content/RexseeContacts$4;->val$account:Ljava/lang/String;

    const-string v4, ""

    invoke-virtual {v2, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_5

    :cond_2
    move-object v6, v5

    .line 629
    .local v6, "accountName":Ljava/lang/String;
    :goto_1
    iget-object v2, p0, Lrexsee/content/RexseeContacts$4;->val$group:Ljava/lang/String;

    if-eqz v2, :cond_3

    iget-object v2, p0, Lrexsee/content/RexseeContacts$4;->val$group:Ljava/lang/String;

    const-string v4, ""

    invoke-virtual {v2, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_6

    :cond_3
    move-object v10, v5

    .line 630
    .local v10, "groupName":Ljava/lang/String;
    :goto_2
    if-eqz v6, :cond_9

    if-eqz v10, :cond_9

    .line 631
    sget-object v1, Landroid/provider/ContactsContract$Data;->CONTENT_URI:Landroid/net/Uri;

    .line 632
    .local v1, "uri":Landroid/net/Uri;
    iget-object v2, p0, Lrexsee/content/RexseeContacts$4;->this$0:Lrexsee/content/RexseeContacts;

    # invokes: Lrexsee/content/RexseeContacts;->getGroupIdByName(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    invoke-static {v2, v6, v10}, Lrexsee/content/RexseeContacts;->access$2(Lrexsee/content/RexseeContacts;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v9

    .line 633
    .local v9, "groupId":Ljava/lang/String;
    if-nez v9, :cond_7

    const-string v2, "[Exception]Group not found."

    .line 652
    .end local v0    # "contentResolver":Landroid/content/ContentResolver;
    .end local v1    # "uri":Landroid/net/Uri;
    .end local v3    # "selection":Ljava/lang/String;
    .end local v6    # "accountName":Ljava/lang/String;
    .end local v9    # "groupId":Ljava/lang/String;
    .end local v10    # "groupName":Ljava/lang/String;
    :goto_3
    return-object v2

    .line 627
    .restart local v0    # "contentResolver":Landroid/content/ContentResolver;
    .restart local v3    # "selection":Ljava/lang/String;
    :cond_4
    :try_start_1
    const-string v4, " AND starred=1"

    goto :goto_0

    .line 628
    :cond_5
    iget-object v2, p0, Lrexsee/content/RexseeContacts$4;->val$account:Ljava/lang/String;

    move-object v6, v2

    goto :goto_1

    .line 629
    .restart local v6    # "accountName":Ljava/lang/String;
    :cond_6
    iget-object v2, p0, Lrexsee/content/RexseeContacts$4;->val$group:Ljava/lang/String;

    move-object v10, v2

    goto :goto_2

    .line 634
    .restart local v1    # "uri":Landroid/net/Uri;
    .restart local v9    # "groupId":Ljava/lang/String;
    .restart local v10    # "groupName":Ljava/lang/String;
    :cond_7
    const-string v2, ""

    invoke-virtual {v3, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-nez v2, :cond_8

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {v3}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v4

    invoke-direct {v2, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v4, " AND "

    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    .line 635
    :cond_8
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {v3}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v4

    invoke-direct {v2, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v4, "data1=\'"

    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v4, "\' AND "

    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v4, "mimetype"

    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v4, "=\'"

    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v4, "vnd.android.cursor.item/group_membership"

    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v4, "\'"

    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    .line 647
    .end local v9    # "groupId":Ljava/lang/String;
    :goto_4
    const/4 v2, 0x1

    new-array v2, v2, [Ljava/lang/String;

    const/4 v4, 0x0

    const-string v5, "display_name"

    aput-object v5, v2, v4

    const/4 v4, 0x0

    const-string v5, "display_name"

    invoke-virtual/range {v0 .. v5}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v7

    .line 648
    .local v7, "cursor":Landroid/database/Cursor;
    const/4 v2, 0x0

    invoke-static {v7, v2}, Lrexsee/core/utilities/Json;->toJson(Landroid/database/Cursor;I)Ljava/lang/String;

    move-result-object v11

    .line 649
    .local v11, "rtn":Ljava/lang/String;
    invoke-interface {v7}, Landroid/database/Cursor;->close()V

    move-object v2, v11

    .line 650
    goto :goto_3

    .line 636
    .end local v1    # "uri":Landroid/net/Uri;
    .end local v7    # "cursor":Landroid/database/Cursor;
    .end local v11    # "rtn":Ljava/lang/String;
    :cond_9
    if-eqz v6, :cond_b

    .line 637
    sget-object v1, Landroid/provider/ContactsContract$RawContacts;->CONTENT_URI:Landroid/net/Uri;

    .line 638
    .restart local v1    # "uri":Landroid/net/Uri;
    const-string v2, ""

    invoke-virtual {v3, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-nez v2, :cond_a

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {v3}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v4

    invoke-direct {v2, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v4, " AND "

    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    .line 639
    :cond_a
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {v3}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v4

    invoke-direct {v2, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v4, "account_name=\'"

    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v4, "\'"

    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    move-result-object v3

    goto :goto_4

    .line 640
    .end local v1    # "uri":Landroid/net/Uri;
    :cond_b
    if-eqz v10, :cond_c

    .line 641
    const-string v2, "[Exception]Account name couldn\'t be null when groupName is not null."

    goto/16 :goto_3

    .line 643
    :cond_c
    :try_start_2
    sget-object v13, Landroid/provider/ContactsContract$Contacts;->CONTENT_URI:Landroid/net/Uri;

    .line 644
    .local v13, "uri":Landroid/net/Uri;
    const-string v2, ""

    invoke-virtual {v3, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_d

    const/4 v3, 0x0

    move-object v12, v3

    .line 645
    .end local v3    # "selection":Ljava/lang/String;
    .local v12, "selection":Ljava/lang/String;
    :goto_5
    sget-object v1, Landroid/provider/ContactsContract$Contacts;->CONTENT_URI:Landroid/net/Uri;

    const/4 v2, 0x1

    new-array v2, v2, [Ljava/lang/String;

    const/4 v4, 0x0

    const-string v5, "display_name"

    aput-object v5, v2, v4

    const/4 v3, 0x0

    const/4 v4, 0x0

    const-string v5, "display_name"

    invoke-virtual/range {v0 .. v5}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0

    move-object v3, v12

    .end local v12    # "selection":Ljava/lang/String;
    .restart local v3    # "selection":Ljava/lang/String;
    move-object v1, v13

    .end local v13    # "uri":Landroid/net/Uri;
    .restart local v1    # "uri":Landroid/net/Uri;
    goto :goto_4

    .line 651
    .end local v0    # "contentResolver":Landroid/content/ContentResolver;
    .end local v1    # "uri":Landroid/net/Uri;
    .end local v3    # "selection":Ljava/lang/String;
    .end local v6    # "accountName":Ljava/lang/String;
    .end local v10    # "groupName":Ljava/lang/String;
    :catch_0
    move-exception v2

    move-object v8, v2

    .line 652
    .local v8, "e":Ljava/lang/Exception;
    new-instance v2, Ljava/lang/StringBuilder;

    const-string v4, "[Exception]"

    invoke-direct {v2, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v8}, Ljava/lang/Exception;->getLocalizedMessage()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    goto/16 :goto_3

    .end local v8    # "e":Ljava/lang/Exception;
    .restart local v0    # "contentResolver":Landroid/content/ContentResolver;
    .restart local v3    # "selection":Ljava/lang/String;
    .restart local v6    # "accountName":Ljava/lang/String;
    .restart local v10    # "groupName":Ljava/lang/String;
    .restart local v13    # "uri":Landroid/net/Uri;
    :cond_d
    move-object v12, v3

    .end local v3    # "selection":Ljava/lang/String;
    .restart local v12    # "selection":Ljava/lang/String;
    goto :goto_5
.end method
